package com.itheima.response;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/demo01")
public class ResponseDemo01Servlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          //地址栏访问 通过get请求进行处理
        System.out.println("请求来了，我使用getOutputStrea()对外输出");
       //因为字节流只能写字节 所以需要将字符串转换成字节数组
        response.getOutputStream().write("你好".getBytes());
    }
}
